<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        var r1 = prompt("请输入菱形的行数：");
        var r2 = prompt("请输入三角形的行数：");
        for (let i = 1; i <= r1; i++) {
            document.write("&nbsp;".repeat(r1-i) + "*".repeat(2 * i - 1));
            document.write("<br>");
        }
        for (let i = r1 - 1; i > 0; i--) {
            document.write("&nbsp;".repeat(r1-i) + "*".repeat(2 * i - 1));
            document.write("<br>");
        }
        document.write("<br><br>");
        for (let i = 0; i < r2; i++) {
            for (let j = 0; j < r2 - i; j++) {
                document.write("*" + "\n");
            }
            document.write("<br>");
        }
    </script>
</body>
</html>